(function (angular) {
    'use strict';

angular.module('xianwan').controller('HeaderController', 
    ['$scope', '$rootScope', '$timeout',
        function ($scope, $rootScope, $timeout) {
            var gui = require('nw.gui');
            var win = gui.Window.get();
            $scope.isOpen = false;
            $scope.isMaximum = false;
            $scope.process = process;

            if (!window.require) {
                return;
            }
            $scope.winClose = function () {
                win.close();
            }
            $scope.minimize = function () {
                win.minimize();
            }
            $scope.maximize = function () {
                if ($scope.isMaximum) {
                    win.unmaximize();
                } else {
                    win.maximize();
                }
                $scope.isMaximum = !$scope.isMaximum;
            }
            $scope.ShowSidebar = function(isTrue){
                if (isTrue) {
                    $scope.isOpen = true;
                    $(".main-content").css("width","calc(100% - 40px)");
                    $(".main-sidebar").css("width","40px");
                }else{
                    $scope.isOpen = false;
                    $(".main-content").css("width","100%");
                    $(".main-sidebar").css("width","0");
                }
            }
            $scope.selectMenu = function(menu){
                console.log(menu)
            }
        }
    ]);
})(angular);